以前都是mysql5.1做的LAMP搭建,比较顺利。试了一下安装mysql5.6.
由于系统没有cmake命令,于是 yum install -y cmake
进行安装
在cmake这里
1
| cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_DATADIR=/data/mysql_data -DMYSQL_UNIX_ADDR=/usr/local/mysql/mysql.sock -DSYSCONFDIR=/etc -DWITH_MYISAM_STORAGE_ENGINE=1 -DWITH_ARCHIVE_STORAGE_ENGINE=1 -DWITH_BLACKHOLE_STORAGE_ENGINE=1 -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_MEMORY_STORAGE_ENGINE=1 -DWITH_READLINE=1 -DMYSQL_TCP_PORT=3306 -DENABLED_LOCAL_INFILE=1 -DWITH_PARTITION_STORAGE_ENGINE=1 -DEXTRA_CHARSETS=all -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci
|
报错如下:
1 2 3 4 5 6 7 8
| -- Could NOT find Curses (missing: CURSES_LIBRARY CURSES_INCLUDE_PATH) CMake Error at cmake/readline.cmake:82 (MESSAGE): Curses library not found. Please install appropriate package, remove CMakeCache.txt and rerun cmake.On Debian/Ubuntu, package name is libncurses5-dev, on Redhat and derivates it is ncurses-devel. Call Stack (most recent call first): cmake/readline.cmake:126 (FIND_CURSES) cmake/readline.cmake:216 (MYSQL_USE_BUNDLED_LIBEDIT) CMakeLists.txt:250 (MYSQL_CHECK_READLINE)
|
解决办法:
1 2 3
| [root@localhost mysql-5.6.1] [root@localhost mysql-5.6.1] [root@localhost mysql-5.5.11]
|
接着继续执行编译
1 2
| cmake...... make && make install
|
编译完成,安装好之后。新建系统用户mysql,并禁止登录
1
| useradd -s /sbin/nologin mysql
|
建立数据库存放目录
1 2
| mkdir -p /data/mysql_data chown -R mysql:mysql /data/mysql_data
|
进行数据库初始化
1 2 3 4 5 6 7
| cd /usr/local/mysql ./scripts/mysql_install_db --user=mysql --datadir=/data/mysql_data cp support-files/my-large.cnf /etc/my.cnf cp support-files/mysql.server /etc/init.d/mysqld chmod 755 /etc/init.d/mysqld vim /etc/init.d/mysqld //添加datadir=路径 service mysqld start -------------------------------服务启动报错
|
报错信息如下
1 2
| [root@centos6 mysql_data] Starting MySQL...The server quit without updating PID file [失败]/mysql_data/centos6.6.pid).
|
解决方法:根据报错信息,怀疑可能文件丢失造成的原因,对比另一个测试机已经搭建好的环境,检查同样的数据库目录下,发现本机少了一个centos6.6.pid文件
1 2 3 4 5
| cd /data/mysql_data //数据库文件存放目录 vi centos6.6.pid //编辑此文件,添加一个pid号码 1583 保存退出。 //1583是我在系统中随意添加的号,只要保证系统进程里没有的ID都可以 service mysqld start 正常启动 ----------------------------成功解决
|